<?php
    require_once './config/config.php';
    require_once './model/db.php';
    require_once './model/products.php';
    $product = new Products();
    $products = $product->selectASC();
    $products2 = $product->selectDESC(); 
    
    if(!empty($_GET["action"])){  
        require './controller/addcart.php';
        print'<script type="text/javascript">';
        print'location.href = "index.php";';
        print'</script>';
    }     
        
?>
<div class="features_items"><!--features_items-->
						<h2 class="title text-center">SẢN PHẨM</h2>
                                                <?php foreach($products2 as $productss) : ?>
						<div class="col-sm-4">
							<div class="product-image-wrapper">
								<div class="single-products">
										<div class="productinfo text-center">
                                                                                    <img src="<?php echo HOST ?>images/product/<?php echo $productss['image'] ?>" alt=""/>
											<h2><?php echo number_format($productss['price'] , 0, ',', '.'); ?> Đồng</h2>
											<p><?php echo $productss['name'] ?></p>
                                                                                        <a href="index.php?action=add&quantity=1&name=<?php echo $productss['name'] ?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Vào giỏ hàng</a>
										</div>
										<div class="product-overlay">
											<div class="overlay-content">
												<h2><?php echo number_format($productss['price'] , 0, ',', '.') ?> Đồng</h2>
												<p><?php echo $productss['name'] ?></p>
												<a href="index.php?action=add&quantity=1&name=<?php echo $productss['name'] ?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Vào giỏ hàng</a>
											</div>
										</div>
                                                                                <img src="<?php echo HOST ?>images/home/new.png" class="new" alt="" />
								</div>
								<div class="choose">
									<ul class="nav nav-pills nav-justified">
										<li><a href="<?php echo HOST ?>view/view_product-detail.php?id=<?php echo $productss['id'] ?>"><i class="fa fa-plus-square"></i>Chi tiết sản phẩm</a></li>
									</ul>
								</div>
							</div>
						</div>
                                                <?php endforeach; ?>
						<?php foreach($products as $productss) : ?>
						<div class="col-sm-4">
							<div class="product-image-wrapper">
								<div class="single-products">
                                                                                <div class="productinfo text-center">
                                                                                    <img src="<?php echo HOST ?>images/product/<?php echo $productss['image'] ?>" alt=""/>
											<h2><?php echo number_format($productss['price'] , 0, ',', '.') ?> Đồng</h2>
											<p><?php echo $productss['name'] ?></p>
											<a href="index.php?action=add&quantity=1&name=<?php echo $productss['name'] ?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Vào giỏ hàng</a>
										</div>
										<div class="product-overlay">
											<div class="overlay-content">
												<h2><?php echo number_format($productss['price'] , 0, ',', '.') ?> Đồng</h2>
												<p><?php echo $productss['name'] ?></p>
												<a href="index.php?action=add&quantity=1&name=<?php echo $productss['name'] ?>" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Vào giỏ hàng</a>
											</div>
										</div>
                                                                        <img src="<?php echo HOST ?>images/home/sale.png" class="new" alt="" />
								</div>
								<div class="choose">
									<ul class="nav nav-pills nav-justified">
                                                                            <li><a href="<?php echo HOST ?>view/view_product-detail.php?id=<?php echo $productss['id'] ?>"><i class="fa fa-plus-square"></i>Chi tiết sản phẩm</a></li>
									</ul>
								</div>
							</div>
						</div>
						 <?php endforeach; ?>
					</div><!--features_items-->